package com.annotation.bean;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * ContextRefreshedEvent:容器刷新前完成（所有的Bean创建之前）会发布这个事件
 * ContextClosedEvent: 关闭容器会发布这个事件
 *
 *  怎么发布一个事件：
 */
@Component
public class TestApplicationEventListener implements ApplicationListener<ApplicationEvent> {

    @Override
    public void onApplicationEvent(ApplicationEvent event) {
        System.out.println("TestEventListener  收到事件："+event.toString());
    }
}
